{% extends 'myadmin/base.html' %}
{% block main_body %}
<style>
    .form-card {
        background: #fff;
        border-radius: 6px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        padding: 20px;
    }
    .form-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid #f1f1f1;
    }
    .form-row {
        display: flex;
        flex-wrap: wrap;
        margin: 0 -10px;
    }
    .form-col {
        flex: 1;
        min-width: 300px;
        padding: 0 10px;
        box-sizing: border-box;
    }
    .form-group {
        margin-bottom: 12px;
        width: 100%;
    }
    .form-group label {
        font-weight: 600;
        font-size: 13px;
        margin-bottom: 5px;
        display: block;
    }
    .form-control {
        width: 100%;
        padding: 6px 10px;
        font-size: 13px;
        height: 34px;
        box-sizing: border-box;
    }
    textarea.form-control {
        height: auto;
        min-height: 120px;
    }
    .required-mark {
        color: #dd4b39;
        margin-left: 3px;
    }
    .btn-group {
        margin-top: 15px;
        display: flex;
        gap: 10px;
        justify-content: flex-end;
    }
    .info-group {
        background-color: #f9f9f9;
        padding: 10px 15px;
        border-radius: 4px;
        margin-bottom: 10px;
    }
    .label-pending {
        background-color: #FFC107;
        color: black;
    }
  .label-processed {
        background-color: #4CAF50;
        color: white;
    }
  .label-rejected {
        background-color: #f44336;
        color: white;
    }
</style>

<section class="content-header">
    <h1>营养顾问建议管理 <small>反馈处理</small></h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-home"></i> 首页</a></li>
        <li><a href="{% url 'myadmin_nutritionistadvice_index' 1 %}">建议管理</a></li>
        <li class="active">反馈处理</li>
    </ol>
</section>

<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">建议反馈处理</h3>
                </div>
                <form method="post" action="{% url 'myadmin_nutritionistadvice_do_feedback' advice.advice_id %}" class="form-card">
                    {% csrf_token %}
                    
                    <!-- 建议基本信息 -->
                    <div class="form-section">
                        <h4><i class="fa fa-info-circle"></i> 建议基本信息</h4>
                        <div class="form-row">
                            <div class="form-col">
                                <div class="info-group">
                                    <label>建议ID：</label> {{ advice.advice_id }}
                                </div>
                                <div class="info-group">
                                    <label>关联用户：</label> {{ advice.user.username }}
                                </div>
                                <div class="info-group">
                                    <label>营养顾问：</label> {{ advice.nutritionist.username }}
                                </div>
                                <div class="info-group">
                                    <label>建议日期：</label> {{ advice.advice_date|date:"Y-m-d" }}
                                </div>
                                <div class="info-group">
                                    <label>当前状态：</label>
                                    {% if advice.status == 'pending' %}
                                        <span class="label label-pending">待处理</span>
                                    {% elif advice.status == 'processed' %}
                                        <span class="label label-processed">已反馈</span>
                                    {% else %}
                                        <span class="label label-rejected">已拒绝</span>
                                    {% endif %}
                                </div>
                            </div>
                            <div class="form-col">
                                <div class="form-group">
                                    <label>建议内容</label>
                                    <textarea class="form-control" disabled>{{ advice.advice_content }}</textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 反馈内容 -->
                    <div class="form-section">
                        <h4><i class="fa fa-reply"></i> 反馈处理</h4>
                        <div class="form-row">
                            <div class="form-col">
                                <div class="form-group">
                                    <label>处理状态 <span class="required-mark">*</span></label>
                                    <select name="status" class="form-control" required>
                                        {% for status in advice.STATUS_CHOICES %}
                                        <option value="{{ status.0 }}" {% if advice.status == status.0 %}selected{% endif %}>
                                            {{ status.1 }}
                                        </option>
                                        {% endfor %}
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>反馈内容</label>
                                    <textarea name="feedback_content" class="form-control" 
                                              placeholder="请输入反馈内容（选填，处理状态为已反馈时建议填写）"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 操作按钮 -->
                    <div class="btn-group">
                        <button type="button" class="btn btn-default" onclick="window.history.back();">返回</button>
                        <button type="reset" class="btn btn-default">重置</button>
                        <button type="submit" class="btn btn-primary">提交反馈</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
{% endblock %}